Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

269
Vistas
i18n-js "missing translation" in Rails app

I have a Rails app that has the languages English, French, and German. I have some JavaScript code that I need to translate. I used the i18n-js gem, but it doesn't work.

My setup:

Manifest.js:

//= require i18n
//= require i18n.js
//= require i18n/translations

config/application.rb:

config.i18n.available_locales = :de

I only want the German version right now, so this is correct.

config/i18n-js.yml:

 translations:
   - file: "app/assets/javascripts/i18n/translations.js"
     only: "*"
     pretty_print: true

Gemfile:

gem 'i18n-js'

Package.json:

 "i18n-js": "^3.8.0",

application.js:

import I18n from 'i18n-js'

window.I18n = I18n
I18n.defaultLocale = "de";
I18n.locale = "de";

My translations.js file looks like this:

I18n.translations || (I18n.translations = {});
I18n.translations["de"] = I18n.extend((I18n.translations["de"] || {}), {
  "activerecord": {
    "attributes": {
      "booking": {
        "comments": "Bemerkungen",
etc.

I can access the I18n object in the console, but as soon as I try to display a translation, it doesn't work: translation missing

Running rake tmp:clear and/or adding config.middleware.use I18n::JS::Middleware to my application.rb doesn't work.

Why isnt't it working?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda